DECLARE @SearchText VARCHAR(max) = 'hpcp_ShareOfCost_SyncMonthlyToPrimary'
DECLARE @MinSearchDate DATETIME = '2013-11-06 00:00'
DECLARE @MaxSearchDate DATETIME = '2013-11-06 23:59'

;WITH
StatatisticalTemporaryTable AS
(
SELECT
	S.sql_handle,
	S.last_elapsed_time / 1000 / 60 AS last_elapsed,
	S.last_logical_reads,
	S.last_logical_writes,
	S.total_elapsed_time / 1000 / 60 AS total_elapsed,
	S.total_logical_reads,
	S.total_logical_writes,
	S.min_elapsed_time / 1000 / 60 AS min_elapsed,
	S.max_elapsed_time / 1000 / 60 AS max_elapsed,
	(SELECT text FROM sys.dm_exec_sql_text(S.sql_handle)) AS SQLStatement,
	(SELECT	query_plan FROM sys.dm_exec_query_plan(S.plan_handle)) AS ExecutionPlan,
	S.last_execution_time
FROM
	sys.dm_exec_query_stats AS S
WHERE
	S.last_execution_time BETWEEN @MinSearchDate AND @MaxSearchDate
)
SELECT
	*
FROM
	StatatisticalTemporaryTable AS STT
WHERE 
	STT.SQLStatement LIKE '%' + @SearchText + '%'
	AND STT.SQLStatement NOT LIKE '%disenroll%'
ORDER BY
	STT.last_execution_time